﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class news : System.Web.UI.Page
{
    db_news dbNews = new db_news();
    public string strcr = "";
    public string title = "";
    public string newstime = "";
    public string hit = "";
    public string content = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] == null)
        {
            Response.Redirect("index.aspx");
        }
        DataSet ds = new DataSet();
        string newsID = Request.QueryString["id"];
        
        ds = dbNews.selectNewsONE(newsID);
        if (ds.Tables[0].Rows.Count == 0 || "1".Equals(ds.Tables[0].Rows[0]["status"].ToString()) )
        {
            title = "";
            newstime ="";
            hit = "";
            content = "";
            Response.Write("<script language=javascript>alert('找不到数据！');</script>");
            return;
        }
        else
        {
            dbNews.newsHitadd(newsID);
            ds = dbNews.selectNewsONE(newsID);
            Page.Title = ds.Tables[0].Rows[0]["title"].ToString() + " - 新闻 - 三剑客在线教育系统";
            title = ds.Tables[0].Rows[0]["title"].ToString();
            newstime = ds.Tables[0].Rows[0]["newstime"].ToString();
            hit = ds.Tables[0].Rows[0]["hit"].ToString();
            content = ds.Tables[0].Rows[0]["newsContent"].ToString();
        }
        news_list.DataSource = dbNews.selectNewsALLTop_hit("10").Tables[0].DefaultView;
        news_list.DataBind();

            
            //Allnews_list.DataSource = dbNews.selectNewsTopAllHit("10").Tables[0].DefaultView;
            //Allnews_list.DataBind();
        
        db_blogroll blogroll = new db_blogroll();
        DataSet ds_blogroll = blogroll.selectBlogrollALL();
        blogrollList.DataSource = ds_blogroll.Tables[0].DefaultView;
        blogrollList.DataBind();

        db_copyright cr = new db_copyright();
        DataSet dscr = cr.selectOne();
        strcr = "Copyright &copy; " + dscr.Tables[0].Rows[0]["cryear"].ToString() + " " + dscr.Tables[0].Rows[0]["owner"].ToString() + " ALL Rights Reserved<br/><a href=\"http://www.miibeian.gov.cn\" target=\"_blank\">" + dscr.Tables[0].Rows[0]["approve"].ToString() + "</a>";

    }
}